/*
 * @Author: 王灿
 * @Date: 2020-03-07 21:22:47
 * @Description: file content
 */
function ajaxFunc(param) {
    window.api.ajax({
        url: param.url,
        method: param.type,
        headers: param.headers || '',
        dataType: param.dataType || '',
        returnAll: param.returnAll || false,
        async: false,
        data: param.ajaxData
    }, function(ret) {
        if (param.method) {
            param.method(ret); //调用方法
            return;
        }
    })
}

export default {
    install: (Vue) => {
        Vue.prototype.$ajax = (url, key, data, fun) => ajaxFunc(url, key, data, fun)
    }
}